package com.samehope.ar.mapper;

import com.samehope.ar.entity.SysUserRole;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 用户项目角色 Mapper 接口
 * </p>
 *
 * @author Zhang Luo
 * @since 2019-12-23
 */
public interface SysUserRoleMapper extends BaseMapper<SysUserRole> {

    SysUserRole findByUser(Long companyId, Long projectId, Long userId , Long roleId);

    /**
     * 查找用户的管理角色关系
     * @param projectId
     * @param userId
     * @return
     */
    List<SysUserRole> findManageUserRoleByProjectAndUser(@Param("projectId") Long projectId,
                                                         @Param("userId") Long userId);

    /**
     * 获取所有的项目用户角色
     * @param projectId
     * @param userId
     * @return
     */
    List<SysUserRole> findRolesByProjectAndUserId(@Param("projectId") Long projectId,
                                                  @Param("userId") Long userId);
}
